﻿using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using System.Data;
using BEGDC.Utility.NHibernate;
using Castle.Services.Transaction;
using System.Collections;
using System.Xml;
using Castle.Facilities.NHibernateIntegration;

namespace BEGDC.PreContract.BLL
{
	public partial class Product: IProduct
	{
        public BEGDC.PreContract.DAL.Product GetProductByName(string productName)
        {
            BEGDC.PreContract.DAL.Product product = BEGDC.PreContract.DAL.Product.FindFirst(new NHibernate.Expression.EqExpression(BEGDC.PreContract.DAL.Product.CONST_ProductName, productName));

            return product;

        }

        public BEGDC.PreContract.DAL.Product GetProductByName(string productName, bool autoAddNew)
        {
            BEGDC.PreContract.DAL.Product product = GetProductByName(productName);

            if (product == null)
            {
                product = new BEGDC.PreContract.DAL.Product();
                product.ProductName = productName;
                product.CreateAndFlush();
            }

            return product;

        }
	}
}



